
export const options = {
    getOption1: () => {
        return {
            color:['#c23531','#2f4554','#61a0a8','#cccccc'],
            title: {
                text: '能量统计',
                top: '10px',
                textStyle: {
                    color: '#f0f0f2'
                }
            },
            tooltip: {
                trigger: 'axis',
                axisPointer: {
                    type: 'cross',
                    label: {
                        backgroundColor: '#6a7985'
                    }
                }
            },
            legend: {
                data: ['牵引能耗', '配电能耗', '再生能馈'],
                bottom: 10,
                textStyle: {
                    color: '#fff'
                }
            },
            grid: {
                left: '3%',
                right: '4%',
                bottom: '15%',
                containLabel: true
            },
            xAxis: [
                {
                    data: ['2021-01-01', '2021-01-02', '2021-01-03', '2021-01-04', '2021-01-05', '2021-01-06', '2021-01-07'],
                    boundaryGap: false
                }
            ],
            yAxis: [
                {
                    type: 'value',
                    show: true,
                    axisTick: {
                        show: true
                    },
                    axisLine: {
                        show: true
                    }
                }
            ],
            series: [
                {
                    name: '牵引能耗',
                    type: 'line',
                    stack: '总量',
                    
                    areaStyle: {
                        color: '#97343a'
                    },
                    emphasis: {
                        focus: 'series'
                    },
                    data: [120, 132, 101, 134, 90, 230, 210]
                },
                {
                    name: '配电能耗',
                    type: 'line',
                    stack: '总量',
                    areaStyle: {
                        color: '#304054'
                    },
                    emphasis: {
                        focus: 'series'
                    },
                    data: [220, 182, 191, 234, 290, 330, 310]
                },
                {
                    name: '再生能馈',
                    type: 'line',
                    stack: '总量',
                    areaStyle: {
                        color: '#5d97a1'
                    },
                    emphasis: {
                        focus: 'series'
                    },
                    data: [-3, -4, -12, -20, -19, -8, -15]
                }
            ]
        }

    },
    getOption2: () => {
        return {
            title: {
                text: '当前故障统计',
                top: '10px',
                textStyle: {
                    color: '#f0f0f2'
                }
            },
            tooltip: {
                trigger: 'item',
                formatter: '{b}:{c} ({d}%)'
            },
            legend: {
                bottom: 10,
                textStyle: {
                    color: '#fff'
                }

            },

            series: [
                {
                    type: 'pie',
                    radius: '50%',
                    data: [
                        { value: 335, name: '一级故障', label: { color: '#c23531' }, itemStyle: { color: '#c23531' } },
                        { value: 310, name: '二级故障', label: { color: '#2f4554' }, itemStyle: { color: '#2f4554' } },
                        { value: 234, name: '预警', label: { color: '#61a0a8' }, itemStyle: { color: '#61a0a8' } },
                    ],
                    emphasis: {
                        itemStyle: {
                            shadowBlur: 10,
                            shadowOffsetX: 0,
                            shadowColor: 'rgba(0, 0, 0, 0.5)',
                        },
                    }
                }
            ]
        }
    }
}

function getSeriesColor(value, colorValue) {
    return { value, itemStyle: { color: colorValue }, label: { color: colorValue } }
}